/* API密钥管理页面样式 - 暗黑酷炫风格 */

.apikey-management-container {
  min-height: 100vh;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
  position: relative;
  padding: 20px;
  color: #e2e8f0;
  overflow-x: hidden;
}

/* 添加背景动态光效 */
.apikey-management-container::before {
  content: '';
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.03) 0%, transparent 50%),
              radial-gradient(circle at 80% 80%, rgba(59, 130, 246, 0.03) 0%, transparent 50%);
  animation: backgroundPulse 20s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}

@keyframes backgroundPulse {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-5%, -5%) scale(1.1); }
}

/* 顶部导航栏 */
.top-bar {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 30px;
  background: rgba(30, 41, 59, 0.7);
  backdrop-filter: blur(20px);
  padding: 15px 20px;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.1);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3),
              inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.back-button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: rgba(51, 65, 85, 0.6);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  color: #e2e8f0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-weight: 500;
}

.back-button:hover {
  background: rgba(71, 85, 105, 0.8);
  border-color: rgba(16, 185, 129, 0.5);
  transform: translateX(-4px);
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.2);
}

.page-title {
  font-size: 26px;
  font-weight: 700;
  background: linear-gradient(135deg, #10b981 0%, #3b82f6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 0;
  text-shadow: 0 0 30px rgba(16, 185, 129, 0.3);
}

.spacer {
  width: 100px;
}

/* 统计卡片 */
.stats-container {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card {
  position: relative;
  background: rgba(30, 41, 59, 0.6);
  backdrop-filter: blur(20px);
  padding: 24px;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.1);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  text-align: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(16, 185, 129, 0.5), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}

.stat-card:hover {
  transform: translateY(-4px);
  border-color: rgba(16, 185, 129, 0.3);
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.4),
              0 0 30px rgba(16, 185, 129, 0.15);
}

.stat-card:hover::before {
  opacity: 1;
}

.stat-label {
  font-size: 13px;
  color: #94a3b8;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
}

.stat-value {
  font-size: 32px;
  font-weight: 700;
  color: #e2e8f0;
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.1);
}

.stat-value.success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* 操作栏 */
.actions-bar {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  gap: 20px;
}

.btn-primary {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 20px rgba(16, 185, 129, 0.3),
              inset 0 1px 0 rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.btn-primary::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

.btn-primary:hover::before {
  left: 100%;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(16, 185, 129, 0.5),
              0 0 40px rgba(16, 185, 129, 0.2);
  border-color: rgba(16, 185, 129, 0.6);
}

.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.search-box {
  flex: 1;
  max-width: 400px;
}

.search-box input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 12px;
  font-size: 14px;
  background: rgba(30, 41, 59, 0.6);
  backdrop-filter: blur(10px);
  color: #e2e8f0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-box input::placeholder {
  color: #64748b;
}

.search-box input:focus {
  outline: none;
  border-color: rgba(16, 185, 129, 0.5);
  background: rgba(30, 41, 59, 0.8);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1),
              0 0 20px rgba(16, 185, 129, 0.15);
}

/* 密钥列表 */
.apikey-list {
  position: relative;
  z-index: 1;
  min-height: 400px;
}

.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  background: rgba(30, 41, 59, 0.6);
  backdrop-filter: blur(20px);
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.1);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.spinner {
  width: 48px;
  height: 48px;
  border: 3px solid rgba(148, 163, 184, 0.2);
  border-top: 3px solid #10b981;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 16px;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  background: rgba(30, 41, 59, 0.6);
  backdrop-filter: blur(20px);
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.1);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  color: #64748b;
}

.empty-state svg {
  margin-bottom: 20px;
  opacity: 0.3;
  color: #64748b;
}

.empty-state p {
  font-size: 16px;
  color: #64748b;
}

/* 密钥卡片 */
.apikey-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
  gap: 20px;
}

.apikey-card {
  position: relative;
  background: rgba(30, 41, 59, 0.6);
  backdrop-filter: blur(20px);
  border-radius: 16px;
  padding: 24px;
  border: 1px solid rgba(148, 163, 184, 0.1);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.apikey-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, 
    transparent, 
    rgba(16, 185, 129, 0.5), 
    rgba(59, 130, 246, 0.5), 
    transparent
  );
  opacity: 0;
  transition: opacity 0.3s;
}

.apikey-card:hover {
  transform: translateY(-4px);
  border-color: rgba(16, 185, 129, 0.3);
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.4),
              0 0 30px rgba(16, 185, 129, 0.15);
}

.apikey-card:hover::before {
  opacity: 1;
}

/* 卡片头部 */
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.key-info {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.key-name {
  font-size: 18px;
  font-weight: 600;
  color: #e2e8f0;
  margin: 0;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
}

.status-badge {
  display: inline-block;
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: 1px solid;
  backdrop-filter: blur(10px);
}

.status-badge.active {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border-color: rgba(16, 185, 129, 0.3);
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.2);
}

.status-badge.disabled {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.3);
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.2);
}

.status-badge.expired {
  background: rgba(100, 116, 139, 0.15);
  color: #64748b;
  border-color: rgba(100, 116, 139, 0.3);
}

.card-actions {
  display: flex;
  gap: 8px;
}

.btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 10px;
  background: rgba(51, 65, 85, 0.5);
  backdrop-filter: blur(10px);
  color: #94a3b8;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-icon:hover {
  background: rgba(71, 85, 105, 0.8);
  border-color: rgba(16, 185, 129, 0.5);
  color: #10b981;
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.2);
  transform: translateY(-2px);
}

.btn-icon.btn-danger:hover {
  background: rgba(71, 85, 105, 0.8);
  border-color: rgba(239, 68, 68, 0.5);
  color: #ef4444;
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.2);
}

/* 密钥显示 */
.key-display {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(10px);
  border-radius: 10px;
  margin-bottom: 18px;
  border: 1px solid rgba(148, 163, 184, 0.15);
  transition: all 0.3s;
}

.key-display:hover {
  border-color: rgba(16, 185, 129, 0.3);
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.1);
}

.key-value {
  flex: 1;
  font-family: 'Courier New', 'Monaco', monospace;
  font-size: 13px;
  color: #94a3b8;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: 0.5px;
}

.btn-copy {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 8px;
  background: rgba(51, 65, 85, 0.5);
  color: #94a3b8;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-copy:hover {
  background: rgba(16, 185, 129, 0.2);
  border-color: rgba(16, 185, 129, 0.5);
  color: #10b981;
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.2);
}

/* 详细信息 */
.key-details {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.05);
}

.detail-row:last-child {
  border-bottom: none;
}

.detail-label {
  color: #64748b;
  font-weight: 500;
}

.detail-value {
  color: #cbd5e1;
  font-weight: 600;
  text-align: right;
}

.scope-tag {
  display: inline-block;
  padding: 4px 10px;
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 6px;
  font-size: 11px;
  margin-left: 6px;
  font-weight: 600;
  backdrop-filter: blur(10px);
}

.text-danger {
  color: #ef4444 !important;
  text-shadow: 0 0 10px rgba(239, 68, 68, 0.3);
}

/* 模态框 */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  background: rgba(30, 41, 59, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 20px;
  max-width: 750px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5),
              0 0 60px rgba(16, 185, 129, 0.1);
  animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 32px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.modal-header h2 {
  font-size: 20px;
  font-weight: 600;
  color: #e2e8f0;
  margin: 0;
}

.btn-close {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(51, 65, 85, 0.5);
  border-radius: 10px;
  font-size: 24px;
  color: #94a3b8;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-close:hover {
  background: rgba(71, 85, 105, 0.8);
  border-color: rgba(239, 68, 68, 0.5);
  color: #ef4444;
  transform: rotate(90deg);
}

/* 表单 */
.modal-form {
  padding: 28px 32px;
}

.form-group {
  margin-bottom: 24px;
}

.form-group label {
  display: block;
  margin-bottom: 10px;
  font-size: 14px;
  font-weight: 600;
  color: #cbd5e1;
  line-height: 1.4;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="datetime-local"],
.form-group select {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 10px;
  font-size: 14px;
  background: rgba(15, 23, 42, 0.5);
  color: #e2e8f0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.form-group input::placeholder {
  color: #64748b;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: rgba(16, 185, 129, 0.5);
  background: rgba(15, 23, 42, 0.7);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1),
              0 0 20px rgba(16, 185, 129, 0.15);
}

.form-hint {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: #64748b;
}

.checkbox-group {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.3);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.checkbox-item:hover {
  border-color: rgba(16, 185, 129, 0.5);
  background: rgba(16, 185, 129, 0.1);
}

.checkbox-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #10b981;
}

.checkbox-item span {
  color: #cbd5e1;
  font-size: 13px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
}

.form-row .form-group {
  margin-bottom: 0;
  min-width: 0;
}

.form-row .form-group label {
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
  padding-right: 8px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid rgba(148, 163, 184, 0.1);
}

.btn-secondary {
  padding: 11px 24px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 10px;
  background: rgba(51, 65, 85, 0.5);
  color: #cbd5e1;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-secondary:hover {
  border-color: rgba(148, 163, 184, 0.5);
  background: rgba(71, 85, 105, 0.8);
  color: #e2e8f0;
}

/* 成功模态框 */
.success-modal {
  max-width: 700px;
}

.success-header {
  flex-direction: column;
  text-align: center;
  padding: 32px 32px 24px;
}

.success-icon {
  color: #10b981;
  margin-bottom: 16px;
  filter: drop-shadow(0 0 20px rgba(16, 185, 129, 0.4));
}

.success-content {
  padding: 0 32px 24px;
}

.warning-box {
  display: flex;
  gap: 12px;
  padding: 16px;
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.3);
  border-radius: 10px;
  margin-bottom: 24px;
  backdrop-filter: blur(10px);
}

.warning-box svg {
  flex-shrink: 0;
  color: #fbbf24;
}

.warning-box strong {
  display: block;
  margin-bottom: 6px;
  color: #fbbf24;
}

.warning-box p {
  margin: 0;
  font-size: 14px;
  color: #cbd5e1;
}

.key-display-full {
  background: rgba(15, 23, 42, 0.5);
  padding: 20px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.key-display-full label {
  display: block;
  margin-bottom: 12px;
  font-size: 14px;
  font-weight: 600;
  color: #cbd5e1;
}

.key-copy-group {
  display: flex;
  gap: 12px;
  align-items: center;
}

.full-key {
  flex: 1;
  padding: 14px;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 10px;
  font-family: 'Courier New', 'Monaco', monospace;
  font-size: 13px;
  color: #10b981;
  word-break: break-all;
  letter-spacing: 0.5px;
}

.btn-copy-large {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 22px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
}

.btn-copy-large:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(16, 185, 129, 0.5);
}

.success-footer {
  padding: 0 32px 28px;
  display: flex;
  justify-content: center;
}

.btn-large {
  padding: 14px 36px;
  font-size: 16px;
}

/* Toast提示 */
.toast {
  position: fixed;
  bottom: 30px;
  right: 30px;
  padding: 16px 28px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid;
  backdrop-filter: blur(20px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  z-index: 2000;
  animation: toastSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes toastSlideIn {
  from {
    transform: translateX(120%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.toast.success {
  background: rgba(16, 185, 129, 0.9);
  border-color: rgba(16, 185, 129, 0.5);
  color: white;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4),
              0 0 40px rgba(16, 185, 129, 0.3);
}

.toast.error {
  background: rgba(239, 68, 68, 0.9);
  border-color: rgba(239, 68, 68, 0.5);
  color: white;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4),
              0 0 40px rgba(239, 68, 68, 0.3);
}

.toast.info {
  background: rgba(59, 130, 246, 0.9);
  border-color: rgba(59, 130, 246, 0.5);
  color: white;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4),
              0 0 40px rgba(59, 130, 246, 0.3);
}

/* 响应式设计 */
@media (max-width: 768px) {
  .apikey-cards {
    grid-template-columns: 1fr;
  }

  .stats-container {
    grid-template-columns: repeat(2, 1fr);
  }

  .actions-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .search-box {
    max-width: none;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .form-row .form-group {
    margin-bottom: 20px;
  }

  .checkbox-group {
    grid-template-columns: 1fr;
  }

  .top-bar {
    flex-direction: column;
    gap: 12px;
  }

  .spacer {
    display: none;
  }

  .modal-content {
    max-width: 95%;
  }
}

/* 中等屏幕优化 */
@media (max-width: 1024px) and (min-width: 769px) {
  .modal-content {
    max-width: 90%;
  }
}
